<%include header %>
<!--在这个里面，开始设计注册表单-->
<div class="zhuced1">
    <br><br><br>
<form method="post">
    <label>用户:</label>
    <input type="text" class="name" name="name" required></br>
    <span class="checkname"> </span><br>
    <label>密码:</label>
    <input type="password" class="password" name="password"><br>
    <span class="checkmima"></span><br>
    <label>确认:</label>
    <input type="password" class="password-repeat" name="password-repeat"></br>
    <span class="qrmima"></span><br>
    <label>邮箱:</label>
    <input type="email" name="email"></br><br>
    <input type="submit" value="注册" style="width: 50px"><br><br>
    <a href="/shouye">返回首页</a>
</form>
    <br>
    <article style="color: orange">
        <% if (success) { %>
        <div><%= success %></div>
        <% } %>
        <% if (error) { %>
        <div><%= error %></div>
        <% } %>
    </article>
</div>

<%include footer %>
<!--对于用户注册的一些要求-->
<script>
$(function () {
    var rel;
    var rel2;
    var username;
    var userpassword;
    var surepassword;
$('.name').focus(function () {
    $(window).keyup(function () {
        //验证用户名是否符合要求
        rel = /^([a-z]|[A-Z])\w{5,9}$/;//用户名
        username = $('.name').val();
        if(rel.test(username)){
            $('.checkname').show().text('用户名格式正确');
        }else{
            $('.checkname').show().text('首位必须是字母且6-10位');
        }
    })
})
    //验证密码
$('.password').focus(function () {
    $(window).keyup(function () {
        rel2 = /^\w{6,16}$/;
        userpassword =$('.password').val();
        if(rel2.test(userpassword)){
            $('.checkmima').show().text('密码格式正确');
        }else{
            $('.checkmima').show().text('密码为字符串，6-16位!');
        }
    })
})
    //检查两次密码是否一致
$('.password-repeat').focus(function () {
    $(window).keyup(function () {
        surepassword =$('.password-repeat').val();
        if(surepassword == userpassword){
            $('.qrmima').show().text('两次密码一致');
        }else{
            $('.qrmima').show().text('密码不一致 请重新输入');
        }
    })
})
})
</script>

